The attached patch uncouples the device id used inside XenD from the
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Thu, 8 Dec 2005 18:19:24 +0000 (18:19 +0000)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Thu, 8 Dec 2005 18:19:24 +0000 (18:19 +0000)
instance number of the vTPM.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
tools/python/xen/xend/server/tpmif.py

index 4545fbe6c6e376f57bf23d6946838422993ec084..a34e598eab5da55735cb1fc6e0be9eeebdb28bd5 100644 (file)
@@ -38,10 +38,14 @@ class TPMifController(DevController):
     def getDeviceDetails(self, config):
         """@see DevController.getDeviceDetails"""
 
-        devid = int(sxp.child_value(config, 'pref_instance', '0'))
-        log.info("The domain has a TPM with instance %d." % devid)
-
-        back  = { 'pref_instance' : "%i" % devid }
+        devid = self.allocateDeviceID()
+        inst = int(sxp.child_value(config, 'pref_instance', '-1'))
+        if inst == -1:
+            inst = int(sxp.child_value(config, 'instance' , '0'))
+
+        log.info("The domain has a TPM with instance %d and devid %d.",
+                 inst, devid)
+        back  = { 'pref_instance' : "%i" % inst }
         front = { 'handle' : "%i" % devid }
 
         return (devid, back, front)